<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> 
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<!--  -->



<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
User user=(User)request.getSession().getAttribute("SESSION_USER");
if(user==null) {
	request.setAttribute("message","未登录");
	request.getRequestDispatcher("error.jsp").forward(request,response);
	return;
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="css/frame.css" rel="stylesheet" type="text/css" />
<link href="css/impromptu.css" rel="stylesheet" type="text/css" />
<title>发布运价</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">


<script src="jslab/jquery-1.7.1.min.js" type="text/javascript" language="javascript"></script>
<script src="jslab/jquery-impromptu.3.3.js" type="text/javascript" language="javascript"></script>


</head>
<script>
	var yunjiaIndex=1;
	function yunjiaAdd() {
		if(yunjiaIndex>=5) {
			alert("最多发布5条运价！！");
			return;
		}
		yunjiaIndex++;
		var str='yunjia'+yunjiaIndex;
		document.getElementById(str).style.display='block';
	}
	function yunjiaDel() {
		if(yunjiaIndex<=1) {
			alert("至少发布1条运价！！");
			return;
		}
		var str='yunjia'+yunjiaIndex;
		var str2='price'+yunjiaIndex;
		var div=document.getElementById(str);
		var yunjia=document.getElementsByName(str2);
		yunjia=yunjia[0];
		yunjia.value="";
		document.getElementById(str).style.display='none';
		yunjiaIndex--;
	}
	
	function veryfy(bt) {
		var i=0,j=0;
		var form=document.getElementById("form");
		var names=form.getElementsByTagName("span");
		var values=form.elements;
		
		var temp;
		var str="<table width='100%' cellpadding=0 cellspacing=2px  style='table-layout:fixed;word-wrap:break-word;'>";
		str+="<tr><td width='20%' style='text-align:right;'>"+names[i++].innerHTML+"：</td><td colspan=3>"+values[j].options[values[j++].selectedIndex].text+"</td></tr>";
		i++;//避开运价来源
		//起运地与目的地
		temp=values[j++].value;
		if(values[j].value!="" && values[j].value!="请选择")	temp+="-"+values[j++].value;
		else j++;
		if(values[j].value!="" && values[j].value!="请选择")	temp+="-"+values[j++].value;
		else j++;
		if(values[j].value!="" && values[j].value!="请选择")	temp+="-"+values[j++].value;
		else j++;
		if(values[j].value!="" && values[j].value!="请选择")	temp+="-"+values[j++].value;
		else j++;
		temp+="<br/>详细:"+values[j++].value;
		str+="<tr><td width='20%' style='text-align:right;'>"+names[i++].innerHTML+"：</td><td colspan=3>"+temp+"</td></tr>";
		temp=values[j++].value;
		if(values[j].value!="" && values[j].value!="请选择")	temp+="-"+values[j++].value;
		else j++;
		if(values[j].value!="" && values[j].value!="请选择")	temp+="-"+values[j++].value;
		else j++;
		if(values[j].value!="" && values[j].value!="请选择")	temp+="-"+values[j++].value;
		else j++;
		if(values[j].value!="" && values[j].value!="请选择")	temp+="-"+values[j++].value;
		else j++;
		temp+="<br/>详细:"+values[j++].value;
		str+="<tr><td width='20%' style='text-align:right;'>"+names[i++].innerHTML+"：</td><td colspan=3>"+temp+"</td></tr>";
		
		str+="<tr><td width='20%' style='text-align:right;'>"+names[i++].innerHTML+"：</td><td colspan=3>"+values[j].options[values[j++].selectedIndex].text+"</td></tr>";//预报班次
		if(values[j].value==null || values[j].value=="")	temp="0";
		else												temp=values[j].value;
		j++;
		str+="<tr><td width='20%' style='text-align:right;'>"+names[i++].innerHTML+"：</td><td colspan=3>"+temp+" 天 "+values[j++].value+" 小时"+"</td></tr>";//运输时间
		str+="<tr><td width='20%' style='text-align:right;'>"+names[i++].innerHTML+"：</td><td colspan=3>"+values[j++].value+"</td></tr>";//承运能力
		str+="<tr><td width='20%' style='text-align:right;'>"+names[i++].innerHTML+"：</td><td colspan=3>"+values[j++].value+" 天 "+"</td></tr>";//有效期
		j=j+2;//两个按钮
		
		//运价录入
		str+="<tr><td width='20%' style='text-align:right;'>"+names[i++].innerHTML+"：</td><td colspan=3>"+values[j].options[values[j++].selectedIndex].text+"："+values[j++].value+"／"+values[j].options[values[j++].selectedIndex].text;
		for(var k=0;k<4;k++) {
			if(values[j+1].value==null || values[j+1].value=="") {
				j=j+3;
				continue;
			}
			else {
				str+="<br/>"+values[j].options[values[j++].selectedIndex].text+"："+values[j++].value+"／"+values[j].options[values[j++].selectedIndex].text;
			}
		}
		str+="</td></tr>";
		if(values[j].value!=0)	temp="原价";
		else					temp="";
		str+="<tr><td width='20%' style='text-align:right;'>"+names[i++].innerHTML+"：</td><td colspan=3>"+temp+values[j].options[values[j++].selectedIndex].text+"</td></tr>";
		str+="<tr><td width='20%' style='text-align:right;'>"+names[i++].innerHTML+"：</td><td colspan=3>"+values[j].options[values[j++].selectedIndex].text+"</td></tr>";
		str+="<tr><td width='20%' style='text-align:right;'>"+names[i++].innerHTML+"：</td><td colspan=3>"+values[j].value+"</td></tr>";
		
		str+="</table>";
		function callback(v,m,f) {//v为按键值,m为message within the active state,f为form的name属性值
			if(v)	form.submit();
			else 	bt.disabled=false;
		}
		$.prompt(str,{ buttons: { 确认: true, 取消: false },submit: callback, show:'slideDown' });
	}
window.onload=function() {
	t1();
	t7();
}
</script>
<body>
<!-- <mytag:logincheck></mytag:logincheck> -->
<!-- 页头 左边栏 -->
<%@ include file="/common/header.jsp" %>
<%@ include file="/common/left-nav.jsp" %>
<script>setLeftFrame(3,1);</script>

<!-- 此处添加本页代码 -->
<div class="mainBlock">
	<div class="mainBlockHeader">
		<li>我的运价  <b>发布运价</b> 选择&nbsp;&nbsp;<font color="#FF0000">插入式</font>&nbsp;&nbsp;或&nbsp;&nbsp;<a href="yunjiaFaOwnImport.jsp">导入式</a></li>
		<li><img src="img/tanhao.gif"></img>系统保留最近半年左右运价，如需查询之前发布运价，请致电客服：400.882.0656</li>
	</div>
	<div class="mainBlockBody">
		<html:form action="/yunjiaFaOwn.do" styleId="form">
		<table class="mainTable" width="100%" height="600px" cellpadding="0" cellspacing="2">
			<tr>
				<td width=50%><span>运输类型</span>*
				<html:select property="yunshuMode">
				    <html:option value="ship">海运</html:option>
				    <html:option value="car">陆运</html:option>
				    <html:option value="plane">空运</html:option>
				    <html:option value="train">铁路</html:option>
				</html:select></td>
				<td width=50%><span>运价来源</span>*<font color="#ACACAC"><%=user.getUserfullname() %></font></td>
			</tr>
			<tr><td colspan="2"><span>装 运 地</span>*<%@ include file="selectStart.jsp" %></td></tr>
			<tr><td colspan="2"><span>目 的 地</span>*<%@ include file="selectEnd.jsp" %></td></tr>
			
			<tr><td colspan=2>&nbsp;</td></tr>
			<tr>
				<td><span>预报班次</span>*
				<html:select property="regularTime" value="不定期">
				    <html:option value="星期一">星期一</html:option>
				    <html:option value="星期二">星期二</html:option>
				    <html:option value="星期三">星期三</html:option>
				    <html:option value="星期四">星期四</html:option>
				    <html:option value="星期五">星期五</html:option>
				    <html:option value="星期六">星期六</html:option>
				    <html:option value="星期日">星期日</html:option>
				    <html:option value="不定期">不定期</html:option>
				</html:select></td>
				<td><span>运输时间</span>*<html:text property="timecostDay" style="width:40px"/>天<html:text property="timecostHour"  style="width:20px"/>小时</td>
			</tr>
			<tr>
				<td><span>承运能力</span>*<html:text property="shipPower"/></td>
			<!--<html:select property="chengyunUnit" value="TEU">
				    <html:option value="TEU">TEU</html:option>
				    <html:option value="吨">吨</html:option>
				    <html:option value="立方米">立方米</html:option>
				</html:select> -->
				<td><span>有 效 期</span>*<html:text property="validDay" value="15" style="width:40px"/>天</td>
			</tr>

			<tr>
				<td colspan=2><span>运价录入</span>* &nbsp;&nbsp;<input type="button" value="添加" onclick="yunjiaAdd();">&nbsp;<input type="button" value="删除" onclick="yunjiaDel()">
					<div id="yunjia1">
							<html:select property="bizhong1" style="width:70px;height:20px;" value="RMB">
											<html:option value="USD">USD</html:option>
											<html:option value="RMB">RMB</html:option>
							</html:select>
							<html:text property="price1" style="width:60px"/>/
							<html:select property="yunshuUnit1" style="width:70px;height:20px;" value="20GP">
											<html:option value="20GP">20GP</html:option>
											<html:option value="40GP">40GP</html:option>
											<html:option value="40HQ">40HQ</html:option>
											<html:option value="TON">TON</html:option>
											<html:option value="CBM">CBM</html:option>
							</html:select>
					</div>
					<div id="yunjia2" style="display:none">
							<html:select property="bizhong2" style="width:70px;height:20px;" value="RMB">
											<html:option value="USD">USD</html:option>
											<html:option value="RMB">RMB</html:option>
							</html:select>
							<html:text property="price2" style="width:60px"/>/
							<html:select property="yunshuUnit2" style="width:70px;height:20px;" value="20GP">
											<html:option value="20GP">20GP</html:option>
											<html:option value="40GP">40GP</html:option>
											<html:option value="40HQ">40HQ</html:option>
											<html:option value="TON">TON</html:option>
											<html:option value="CBM">CBM</html:option>
							</html:select>
					</div>
					<div id="yunjia3" style="display:none">
							<html:select property="bizhong3" style="width:70px;height:20px;" value="RMB">
											<html:option value="USD">USD</html:option>
											<html:option value="RMB">RMB</html:option>
							</html:select>
							<html:text property="price3" style="width:60px"/>/
							<html:select property="yunshuUnit3" style="width:70px;height:20px;" value="20GP">
											<html:option value="20GP">20GP</html:option>
											<html:option value="40GP">40GP</html:option>
											<html:option value="40HQ">40HQ</html:option>
											<html:option value="TON">TON</html:option>
											<html:option value="CBM">CBM</html:option>
							</html:select>
					</div>
					<div id="yunjia4" style="display:none">
							<html:select property="bizhong4" style="width:70px;height:20px;" value="RMB">
											<html:option value="USD">USD</html:option>
											<html:option value="RMB">RMB</html:option>
							</html:select>
							<html:text property="price4" style="width:60px"/>/
							<html:select property="yunshuUnit4" style="width:70px;height:20px;" value="20GP">
											<html:option value="20GP">20GP</html:option>
											<html:option value="40GP">40GP</html:option>
											<html:option value="40HQ">40HQ</html:option>
											<html:option value="TON">TON</html:option>
											<html:option value="CBM">CBM</html:option>
							</html:select>
					</div>	
					<div id="yunjia5" style="display:none">
							<html:select property="bizhong5" style="width:70px;height:20px;" value="RMB">
											<html:option value="USD">USD</html:option>
											<html:option value="RMB">RMB</html:option>
							</html:select>
							<html:text property="price5" style="width:60px"/>/
							<html:select property="yunshuUnit5" style="width:70px;height:20px;" value="20GP">
											<html:option value="20GP">20GP</html:option>
											<html:option value="40GP">40GP</html:option>
											<html:option value="40HQ">40HQ</html:option>
											<html:option value="TON">TON</html:option>
											<html:option value="CBM">CBM</html:option>
							</html:select>
					</div>						
					
				</td>
			</tr>
			<tr><td colspan=2><span>运价说明</span>
						<html:select property="discount"  value="0">
										<html:option value="0">普通</html:option>
										<html:option value="4">-4%</html:option>
										<html:option value="8">-8%</html:option>
										<html:option value="10">-10%</html:option>
										<html:option value="13">-13%</html:option>
						</html:select></td>
			</tr>
			<tr><td colspan=2><span>是否特价</span>	
						<html:select property="tejia"  value="no">
										<html:option value="yes">ON</html:option>
										<html:option value="no">OFF</html:option>
						</html:select>&nbsp;&nbsp;<font color="#FF0000">OFF=不推荐 ON=推荐</font>
				</td>
			</tr>
			<tr><td colspan=2><span style="float:left;">备注</span><html:textarea property="remark"  rows="5" cols="50"/></td></tr>
			<tr><td colspan=2><input type="button" value="发布" onclick="veryfy(this)"></td></tr>
			</table>
		</html:form>
	</div>
</div>

<!-- 页脚 -->
<%@ include file="/common/footer.jsp" %>
</body>
</html>